package com.lvmama.dashboard.model.page;

import java.io.Serializable;

public class Page implements Serializable {
	private static final long serialVersionUID = -2401087280195692271L;
	public Page(int page, int pageSize, long totalSize) {
		this.page = page;
		this.pageSize = pageSize;
		this.totalSize = totalSize;
	}
	public Page(int page, int pageSize) {
		this.page = page;
		this.pageSize = pageSize;
	}
	/** 当前页码 */
	private int page;
	/** 每页条数 */
	private int pageSize;
	/** 总行数 */
	private long totalSize;
	public int getPage() {
		return page;
	}
	public int getPageStartRow() {
		return (page - 1) * pageSize + 1;
	}
	public int getPageEndRow() {
		return page * pageSize;
	}
	public int getTotalPage() {
		return (int) (totalSize/pageSize);
	}
	public boolean hasNextPage() {
		return getTotalPage() > getPage();
	}
	public boolean hasPreviousPage() {
		return getPage() > 0;
	}
	public int getPageSize() {
		return pageSize;
	}
	public long getTotalSize() {
		return totalSize;
	}
	public void setTotalSize(long totalSize) {
		this.totalSize = totalSize;
	}
}
